<!DOCTYPE html>
<meta charset="utf-8">
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<p>This tests horizontal caret movement in vertical writing mode.</p>
<div id="test" style="font-family: Courier New; font-size: 20px; height: 15ex; -webkit-writing-mode: vertical-rl;-webkit-text-orientation:sideways-right;text-rendering:optimizeLegibility; outline: none;" contenteditable>
<p id="p1" dir="rtl">אני חתול.</p><p id="p2" dir="rtl">אין לי שם.</p>
</div>
<div id="log"></div>
<script>
test(function() {
    var selection = window.getSelection();
    var p1 = document.getElementById('p1');
    selection.collapse(p1.firstChild, 5);
    selection.modify('Extend', 'Forward', 'Line');

    assert_false(selection.isCollapsed, 'isCollapsed');
    assert_equals(selection.anchorNode, p1.firstChild, 'anchorNode');
    assert_equals(selection.anchorOffset, 5, 'anchorOffset');
    assert_equals(selection.focusNode, p2.firstChild, 'focusNode');
    assert_equals(selection.focusOffset, 5, 'focusOffset');
});
</script>
